package com.my.service
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	
	import mx.controls.Alert;
	
	[Bindable]
	public class ConfigService
	{
		private static var instance : ConfigService;
		
		public var mainDataServiceURL : String;
		public var codeURL : String;
		
		public static function getInstance():ConfigService{
			if(instance == null){
				instance  = new ConfigService();
			}
			return instance;
		}
		
		public function ConfigService()
		{
			var loader : URLLoader = new URLLoader(new URLRequest("com/my/assets/config.xml"));
			loader.addEventListener(Event.COMPLETE,handlerComplete);
			
			function handlerComplete(event:Event):void{
				var loader : URLLoader = URLLoader(event.target);
				var configXml : XML = XML(loader.data);
				
				mainDataServiceURL = configXml.request.http.url;
				codeURL = configXml.code;
				
//				Alert.show(mainDataServiceURL+"++++++++++++");
			}
		}
	}
}